/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.imenu.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Yunzi
 */
@Entity
@Table(name = "imenu_user")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ImenuUser.findAll", query = "SELECT i FROM ImenuUser i"),
    @NamedQuery(name = "ImenuUser.findById", query = "SELECT i FROM ImenuUser i WHERE i.id = :id"),
    @NamedQuery(name = "ImenuUser.findByUsername", query = "SELECT i FROM ImenuUser i WHERE i.username = :username"),
    @NamedQuery(name = "ImenuUser.findByPassword", query = "SELECT i FROM ImenuUser i WHERE i.password = :password")})
public class ImenuUser implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id", insertable=false)
    private Integer id;
    @Size(max = 255)
    @Column(name = "username")
    private String username;
    @Size(max = 255)
    @Column(name = "password")
    private String password;
    @JoinColumn(name = "store_id", referencedColumnName = "id")
    @ManyToOne
    private ImenuStore store;

    public ImenuUser() {
    }

    public ImenuUser(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public ImenuStore getStore() {
        return store;
    }

    public void setStore(ImenuStore store) {
        this.store = store;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ImenuUser)) {
            return false;
        }
        ImenuUser other = (ImenuUser) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.imenu.entity.ImenuUser[ id=" + id + " ]";
    }
    
}
